public class Main {


//        public static void main(String[] args) {
//            int sum = 0;
//            for (int i = 1; i <= 5; i++) {
//                sum += fac(i);
//            }
//            System.out.println("sum = " + sum);
//        }

    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        swap(a, b);
        System.out.println("main: a = " + a + " b = " + b);
    }
    public static void swap(int x, int y) {
        int tmp = x;
        x = y;
        y = tmp;
        System.out.println("swap: x = " + x + " y = " + y);
    }

// 运行结果
//    swap: x = 20 y = 10
//    main: a = 10 b = 2
    public static int fac(int n) {
        System.out.println("计算 n 的阶乘中n! = " + n);
        int result = 1;
        for (int i = 1; i <= n; i++) {
            result *= i;
        }
        return result;
    }

    public static void main1(String[] args) {
        int n=5;
        System.out.println(fac(n));

    }

    // 执行结果 计算 n 的阶乘中 n! = 1 计算 n 的阶乘中 n! = 2 计算 n 的阶乘中 n! = 3 计算 n 的阶乘中 n! = 4 计算 n 的阶乘中 n! = 5 sum = 153
    public static int func2(int a,int b){

        return a+b;

    }

    public static void func1() {


        int year = 1900;
        if ((0 == year % 4 && 0 != year % 100) || 0 == year % 400) {
            System.out.println(year + "年是闰年");
        } else {
            System.out.println(year + "年不是闰年");
        }
    }
}
